<template>
  <div class="space">
    <el-row><el-button type="danger">清除日志</el-button></el-row>
    <el-row :gutter="5">
      <el-col :span="1.5">删除策略 : </el-col>
      <el-col :span="0.5">
        <el-tooltip
          effect="dark"
          content="当客户端存储小于1G时，删除过期超过7天的资源"
          placement="bottom"
        >
          <i class="el-icon-info class='tips"></i> </el-tooltip
      ></el-col>
      <el-col :span="1">
        <el-switch
          v-model="value"
          active-color="#13ce66"
          inactive-color="#ff4949"
        >
        </el-switch>
      </el-col>
    </el-row>
    <el-row>
      <div class="pie" style="height:69vh;width:1200px" ref="pieRef"></div>
    </el-row>
  </div>
</template>
<script>
// 引入 echarts 核心模块，核心模块提供了 echarts 使用必须要的接口。
import * as echarts from 'echarts/core'
// 引入柱状图图表，图表后缀都为 Chart
import { PieChart } from 'echarts/charts'

import { TooltipComponent, LegendComponent } from 'echarts/components'
// 标签自动布局，全局过渡动画等特性
import { LabelLayout } from 'echarts/features'
// 引入 Canvas 渲染器，注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import { CanvasRenderer } from 'echarts/renderers'
// 注册必须的组件
echarts.use([
  TooltipComponent,
  LegendComponent,
  PieChart,
  CanvasRenderer,
  LabelLayout
])
export default {
  data () {
    return {
      value: true,
      option: {
        tooltip: {
          trigger: 'item'
        },
        legend: {
          top: '5%',
          left: 'center'
        },
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: ['40%', '70%'],
            avoidLabelOverlap: false,
            label: {
              show: false,
              position: 'center'
            },
            emphasis: {
              label: {
                show: true,
                fontSize: '40',
                fontWeight: 'bold'
              }
            },
            labelLine: {
              show: false
            },
            data: [
              { value: 1048, name: 'Search Engine' },
              { value: 735, name: 'Direct' },
              { value: 580, name: 'Email' },
              { value: 484, name: 'Union Ads' },
              { value: 300, name: 'Video Ads' }
            ]
          }
        ]
      }
    }
  },
  methods: {
    pieInit () {
      let pie = echarts.init(this.$refs.pieRef)
      pie.setOption(this.option)
    }
  },
  mounted () {
    this.pieInit()
  }
}
</script>
